var arr = [1,2,3,4,5,12,3,3]
function sum (arr,total = 0) {
    if (arr.length === 0) {
        return total
    } else {
        total += arr[0]
    }
    return sum(arr.slice(1),total)
}
console.log(`sum(arr)`, sum(arr)) 